//
//  activityView.m
//  location
//
//  Created by Dongxiang Xu on 2025/8/26.
//

#import "ActivityView.h"

@implementation ActivityView

- (instancetype)initWithFrame:(CGRect)frame
                       
{
    self = [super initWithFrame:frame];
    if (self) {
        for (int i = 0; i < 3; i ++) {
            UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(4+i*4, 7, 2, 4)];
            img.image = [UIImage imageNamed:[NSString stringWithFormat:@"activity_arrow%d",i+1]];
            img.contentMode = UIViewContentModeScaleAspectFill;
            img.tag = 50+i;
            [self addSubview:img];
        }
        [self animation];
    }
    return self;
}

- (void)animation
{
    CGFloat x = [self viewWithTag:52].x;
    [self viewWithTag:52].x = [self viewWithTag:50].x;
    [self viewWithTag:50].x = [self viewWithTag:51].x;
    [self viewWithTag:51].x = x;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self animation];
    });
    
}

@end
